﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.ComponentModel
{
    public class PropertyChangingEventArgsExt<T>: PropertyChangingEventArgs
    {
        public PropertyChangingEventArgsExt(string propertyName, T OldValue, T NewValue)
            :base(propertyName)
        {
            this.OldValue = OldValue;
            this.NewValue = NewValue;
        }

        private T _OldValue;
        /// <summary>
        /// Заменяемое значение
        /// </summary>
        public T OldValue
        {
            get
            {
                return _OldValue;
            }
            private set
            {
                _OldValue = value;
            }
        }

        private T _NewValue;
        /// <summary>
        /// Заменяющее значение
        /// </summary>
        public T NewValue
        {
            get
            {
                return _NewValue;
            }
            private set
            {
                _NewValue = value;
            }
        }

        private bool _Handled = false;
        /// <summary>
        /// Признак обработки события
        /// </summary>
        public bool Handled
        {
            get
            {
                return _Handled;
            }
            set
            {
                _Handled = value;
            }
        }
    }

    public class PropertyChangingEventArgsExt : PropertyChangingEventArgsExt<object>
    {
        public PropertyChangingEventArgsExt(string propertyName, object OldValue, object NewValue)
            : base(propertyName, OldValue, NewValue)
        { }
    }
}
